from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, BooleanField, PasswordField, SelectField, TextAreaField, HiddenField
from wtforms.validators import DataRequired, Length, Email, Regexp, EqualTo


class HostForm(FlaskForm):
    host_type = SelectField('密码类型', choices=[('pwd', '密码'), ('pwdkey', '密钥')],
                              validators=[DataRequired(message='不能为空'), Length(0, 64, message='长度不正确')])
    host_name = StringField('主机名称', validators=[DataRequired(message='不能为空'), Length(0, 25, message='长度不正确')])
    host_ip = StringField('主机ip', validators=[DataRequired(message='不能为空'), Length(0, 25, message='长度不正确')])
    host_user = StringField('用户名', validators=[DataRequired(message='不能为空'), Length(0, 25, message='长度不正确')])
    host_pwd = StringField('密码', validators=[DataRequired(message='不能为空'), Length(0, 50, message='长度不正确')])
    host_pwd_key = StringField('密钥', validators=[DataRequired(message='不能为空'), Length(0, 500, message='长度不正确')])
    status = BooleanField('生效标识', default=True)
    submit = SubmitField('提交')
